<!--
* Created by Sean on 2017/10/1.
* Setting
-->
<template>
  <div id="setting" class="setting">
    <!--<div class="setting-top">
      <span class="goBack" @click="goBack"><返回</span>
      <span class="set">设置</span>
    </div>-->
    <group class="setting-group">
      <cell title="使用帮助" link="/userHelp" v-if="userRole === 'renter'" is-link></cell>
      <cell title="我的银行卡" link="/cardSetting" v-if="userRole === 'renter'" is-link></cell>
      <cell title="修改密码" link="/resetPwd" is-link></cell>
      <cell title="意见反馈" link="/feedback" is-link></cell>
      <cell title="用户协议" link="/aboutContract" v-if="userRole === 'landlord'" is-link></cell>
      <cell title="广州城投租房租赁信息平台" link="/about"  v-if="userRole === 'renter'" is-link></cell>
      <!--<cell title="微信关联授权" link="/bindWeChat" is-link></cell>-->
    </group>
    <x-button text="退出登录" @click.stop.native="logout"></x-button>
  </div>
</template>
<script>
  import { Cell } from 'vux'
  export default {
    name: 'setting',
    components: {
      Cell
    },
    data () {
      return {
        userRole: ''
      }
    },
    created () {
      this.userRole = this.$store.state.login.userRole || 'renter'
    },
    methods: {
      logout () {
        // this.$store.commit('login/logout')
        // window.localStorage.removeItem('userId')
        // window.localStorage.removeItem('nickname')
        // window.localStorage.removeItem('headUrlImg')
        window.localStorage.removeItem('userInfo')
        // window.localStorage.clear()
        this.$router.push({ path: '/' })
      },
      goBack () {
        this.$router.go(-1)
      }
    }
  }
</script>
<style lang="less">
  .setting {
    height: 100vh;
    background: #f2f5fb;
    .goBack{
      // background: blue;
      line-height: 50px;
      font-size: 16px;
      color: white;
      position: absolute;
      left: 8%;
      z-index: 99;
    }
    .set{
      width: 100%;
      position: absolute;
      text-align: center;
    }
    .setting-top{
      width: 100%;
      height: 50px;
      line-height: 50px;
      background:rgb(33,207,250);
      color: white;
      font-size: 25px;
      position: relative;
    }
    // .setting-group{ }
    .weui-cells {
      background: transparent;
    }
    .weui-cells {
      margin-top: 0;
    }
    .weui-cell {
      background: #fff;
    }
    .weui-btn {
      margin-top: .4rem;
      color: #0068d9;
      background: #fff;
      border-radius: 0;
    }
    .weui-btn:after {
      border-radius: 0;
    }
  }
</style>
